var captchapng=require('captchapng');

module.exports= ()=>{
    var code=parseInt(Math.random()*9000+1000);
    var p = new captchapng(86,35,parseInt(code)); // width,height,numeric captcha
    p.color(255, 255, 255, 255);  // First color: background (red, green, blue, alpha)
    p.color(10, 200, 10, 255); // Second color: paint (red, green, blue, alpha)
    return {code:code,imgData:'data:image/png;base64,'+new Buffer(p.getBase64(),'base64').toString('base64')};
}